package com.study.csc.mythreadtest.test4case1;

/**
 * @author csc
 * @Date 2023/10/23 12:56
 * @PackageName:com.study.csc.mythreadtest.test4case1
 * @ClassName: Test
 * @Description: TODO
 * @Version 1.0
 */
public class Test {


    public static void main(String[] args) {
        /**
         *  微信中的抢红包也用到了多线程.
         *  假设: 100块,分成了3个包,现在有五个人去抢
         *  其中,红包是共享数据，
         *  5个人5条线程
         *  打印结果如下:
         *          xxx抢到了xxx元
         *          xxx抢到了xxx元
         *          xxx抢到了xxx元
         *          xxx没抢到
         *          xxx没抢到
         */

        MyThread  t1 = new MyThread();
        MyThread  t2 = new MyThread();
        MyThread  t3 = new MyThread();
        MyThread  t4 = new MyThread();
        MyThread  t5 = new MyThread();

        t1.setName("one");
        t2.setName("two");
        t3.setName("three");
        t4.setName("four");
        t5.setName("five");

        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
    }

}
